﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.Client.Utils
{
    /// <summary>
    /// 日期时间帮助
    /// </summary>
    public static class DateTimeUtils
    {
        /// <summary>
        /// 开始时间
        /// </summary>
        public static readonly DateTime Begin_DateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);

        /// <summary>
        /// 获取当前Utc时间时间戳的毫秒数
        /// </summary>
        public static long CurrentUtcTimeStampMilliseconds
        {
            get
            {
                TimeSpan ts = DateTime.UtcNow - Begin_DateTime;
                return (long)ts.TotalMilliseconds;
            }
        }

        /// <summary>
        /// 获取当前Utc时间时间戳的秒数
        /// </summary>
        public static long CurrentUtcTimeStampSeconds
        {
            get
            {
                TimeSpan ts = DateTime.UtcNow - Begin_DateTime;
                return (long)ts.TotalSeconds;
            }
        }

        /// <summary>
        /// 获取当前时间时间戳的毫秒数
        /// </summary>
        public static long CurrentTimeStampMilliseconds
        {
            get
            {
                TimeSpan ts = DateTime.Now - Begin_DateTime;
                return (long)ts.TotalMilliseconds;
            }
        }

        /// <summary>
        /// 获取当前时间时间戳的秒数
        /// </summary>
        public static long CurrentTimeStampSeconds
        {
            get
            {
                TimeSpan ts = DateTime.Now - Begin_DateTime;
                return (long)ts.TotalSeconds;
            }
        }
    }
}
